import request from '@/config/axios'

// 知识点 VO
export interface KnowledgePointVO {
  id: number // 主键
  pointName: string // 知识点名称
  creatorName: string // 创建人
  updaterName: string // 更新人
  version: number // 版本号
}

// 知识点 API
export const KnowledgePointApi = {
  // 查询知识点分页
  getKnowledgePointPage: async (params: any) => {
    return await request.get({ url: `/common/knowledge-point/page`, params })
  },

  // 查询知识点详情
  getKnowledgePoint: async (id: number) => {
    return await request.get({ url: `/common/knowledge-point/get?id=` + id })
  },

  // 新增知识点
  createKnowledgePoint: async (data: KnowledgePointVO) => {
    return await request.post({ url: `/common/knowledge-point/create`, data })
  },

  // 修改知识点
  updateKnowledgePoint: async (data: KnowledgePointVO) => {
    return await request.put({ url: `/common/knowledge-point/update`, data })
  },

  // 删除知识点
  deleteKnowledgePoint: async (id: number) => {
    return await request.delete({ url: `/common/knowledge-point/delete?id=` + id })
  },

  // 导出知识点 Excel
  exportKnowledgePoint: async (params) => {
    return await request.download({ url: `/common/knowledge-point/export-excel`, params })
  },
}